package Chuong03;

import java.awt.*;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Bai04 extends JPanel{
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		g.drawLine(0,  50, 200, 50);
		g.drawLine(50, 0, 50, 500);
		
		int[] x = new int[100];
		int[] y = new int[100];
		int k=0;
		for (int i = -10; i < 20; i++){
			x[k] = i + 50;
			y[k] = 3*i*i - 6*i + 1 +50;
			System.out.println(x[k] + ","+ y[k]);
			k++;
		}	
		g.setColor(Color.RED);
		g.drawPolyline(x,  y,  23);
		g.setColor(Color.BLUE);
		g.drawString("O", 50, 50);
		g.drawString("X+", 190, 50);
		g.drawString("Y+", 50, 500);
	}
	
	public static void main(String[] args) {
		JFrame f = new JFrame("Chuong03_04");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Bai04 panel = new Bai04();
		f.add(panel);
		f.setSize(400, 700);
		f.setVisible(true);

	}

}
